// 联合类型

function combine(input1: number | string, input2: number | string) {
    let result;

    if(typeof input1 === 'number' && typeof input2 === 'number') {
        result = input1 + input2
    } else {
        result = input1.toString() + input2.toString()
    }
    return result
}

const result = combine(10, 20)
console.log(result)

const result2 = combine('小黑', '小名')
console.log(result2)